home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-02-10 | 9.6 KB | 603 lines | [TEXT/MPS ] |
- /*------------------------------------------------------------------------------
- #
- # Apple Macintosh Developer Technical Support
- #
- # MultiFinder-Aware Simple Sample Application
- #
- # Sample
- #
- # Sample.r - Rez Source
- #
- # Copyright © 1989 Apple Computer, Inc.
- # All rights reserved.
- #
- # Versions:
- # 1.00 08/88
- # 1.01 11/88
- # 1.02 04/89
- # 1.03 06/89
- #
- # Components:
- # Sample.p June 1, 1989
- # Sample.c June 1, 1989
- # Sample.a June 1, 1989
- # Sample.inc1.a June 1, 1989
- # SampleMisc.a June 1, 1989
- # Sample.r June 1, 1989
- # Sample.h June 1, 1989
- # PSample.make June 1, 1989
- # CSample.make June 1, 1989
- # ASample.make June 1, 1989
- #
- # Sample is an example application that demonstrates how to
- # initialize the commonly used toolbox managers, operate
- # successfully under MultiFinder, handle desk accessories,
- # and create, grow, and zoom windows.
- #
- # It does not by any means demonstrate all the techniques
- # you need for a large application. In particular, Sample
- # does not cover exception handling, multiple windows/documents,
- # sophisticated memory management, printing, or undo. All of
- # these are vital parts of a normal full-sized application.
- #
- # This application is an example of the form of a Macintosh
- # application; it is NOT a template. It is NOT intended to be
- # used as a foundation for the next world-class, best-selling,
- # 600K application. A stick figure drawing of the human body may
- # be a good example of the form for a painting, but that does not
- # mean it should be used as the basis for the next Mona Lisa.
- #
- # We recommend that you review this program or TESample before
- # beginning a new application.
- ------------------------------------------------------------------------------*/
-
-
- #include "Types.r"
- #include "SysTypes.r"
-
- #include "Sample.h"
-
- /* we use an MBAR resource to conveniently load all the menus */
-
- resource 'MBAR' (rMenuBar, preload) {
- { mApple, mFile, mEdit, mPassword }; /* four menus */
- };
-
-
- resource 'MENU' (mApple, preload) {
- mApple, textMenuProc,
- AllItems & ~MenuItem2, /* Disable dashed line, enable About and DAs */
- enabled, apple,
- {
- "About Sample…",
- noicon, nokey, nomark, plain;
- "-",
- noicon, nokey, nomark, plain
- }
- };
-
- resource 'MENU' (mFile, preload) {
- mFile, textMenuProc,
- MenuItem12, /* enable Quit only, program enables others */
- enabled, "File",
- {
- "New",
- noicon, "N", nomark, plain;
- "Open",
- noicon, "O", nomark, plain;
- "-",
- noicon, nokey, nomark, plain;
- "Close",
- noicon, "W", nomark, plain;
- "Save",
- noicon, "S", nomark, plain;
- "Save As…",
- noicon, nokey, nomark, plain;
- "Revert",
- noicon, nokey, nomark, plain;
- "-",
- noicon, nokey, nomark, plain;
- "Page Setup…",
- noicon, nokey, nomark, plain;
- "Print…",
- noicon, nokey, nomark, plain;
- "-",
- noicon, nokey, nomark, plain;
- "Quit",
- noicon, "Q", nomark, plain
- }
- };
-
- resource 'MENU' (mEdit, preload) {
- mEdit, textMenuProc,
- NoItems, /* disable everything, program does the enabling */
- enabled, "Edit",
- {
- "Undo",
- noicon, "Z", nomark, plain;
- "-",
- noicon, nokey, nomark, plain;
- "Cut",
- noicon, "X", nomark, plain;
- "Copy",
- noicon, "C", nomark, plain;
- "Paste",
- noicon, "V", nomark, plain;
- "Clear",
- noicon, nokey, nomark, plain
- }
- };
-
- resource 'MENU' (mPassword, preload) {
- mPassword, textMenuProc,
- NoItems, /* disable everything, program does the enabling */
- enabled, "Password",
- {
- "Two Item Password Dialog",
- noicon, nokey, nomark, plain;
- "Different Font Password Dialog",
- noicon, nokey, nomark, plain;
- "Internal Buffer Password Dialog",
- noicon, nokey, nomark, plain
- }
- };
-
-
- /* this ALRT and DITL are used as an About screen */
-
- resource 'ALRT' (rAboutAlert, purgeable) {
- {40, 20, 160, 290},
- rAboutAlert,
- { /* array: 4 elements */
- /* [1] */
- OK, visible, silent,
- /* [2] */
- OK, visible, silent,
- /* [3] */
- OK, visible, silent,
- /* [4] */
- OK, visible, silent
- }
- };
-
- resource 'DITL' (rAboutAlert, purgeable) {
- { /* array DITLarray: 5 elements */
- /* [1] */
- {88, 180, 108, 260},
- Button {
- enabled,
- "OK"
- },
- /* [2] */
- {8, 8, 24, 214},
- StaticText {
- disabled,
- "Simple Sample"
- },
- /* [3] */
- {32, 8, 48, 237},
- StaticText {
- disabled,
- "Copyright © 1989 Apple Computer"
- },
- /* [4] */
- {56, 8, 72, 136},
- StaticText {
- disabled,
- "Brought to you by:"
- },
- /* [5] */
- {80, 24, 112, 167},
- StaticText {
- disabled,
- "Macintosh Developer Technical Support"
- }
- }
- };
-
-
- /* this ALRT and DITL are used as an error screen */
-
- resource 'ALRT' (rUserAlert, purgeable) {
- {40, 20, 120, 260},
- rUserAlert,
- { /* array: 4 elements */
- /* [1] */
- OK, visible, silent,
- /* [2] */
- OK, visible, silent,
- /* [3] */
- OK, visible, silent,
- /* [4] */
- OK, visible, silent
- }
- };
-
-
- resource 'DITL' (rUserAlert, purgeable) {
- { /* array DITLarray: 3 elements */
- /* [1] */
- {50, 150, 70, 230},
- Button {
- enabled,
- "OK"
- },
- /* [2] */
- {10, 60, 30, 230},
- StaticText {
- disabled,
- "Sample - Error occurred!"
- },
- /* [3] */
- {8, 8, 40, 40},
- Icon {
- disabled,
- 2
- }
- }
- };
-
-
- resource 'WIND' (rWindow, preload, purgeable) {
- {60, 40, 290, 160},
- noGrowDocProc, visible, noGoAway, 0x0, "Traffic"
- };
-
-
- /* here is the quintessential MultiFinder friendliness device, the SIZE resource */
-
- resource 'SIZE' (-1) {
- dontSaveScreen,
- acceptSuspendResumeEvents,
- enableOptionSwitch,
- canBackground, /* we can background; we don't currently, but our sleep value */
- /* guarantees we don't hog the Mac while we are in the background */
- multiFinderAware, /* this says we do our own activate/deactivate; don't fake us out */
- backgroundAndForeground, /* this is definitely not a background-only application! */
- dontGetFrontClicks, /* change this is if you want "do first click" behavior like the Finder */
- ignoreChildDiedEvents, /* essentially, I'm not a debugger (sub-launching) */
- not32BitCompatible, /* this app should not be run in 32-bit address space */
- reserved,
- reserved,
- reserved,
- reserved,
- reserved,
- reserved,
- reserved,
- 100000,
- 100000
- };
-
- resource 'DLOG' (200) {
- {38, 16, 137, 255},
- dBoxProc,
- visible,
- goAway,
- 0x0,
- 200,
- ""
- };
-
- resource 'DLOG' (300) {
- {44, 28, 112, 223},
- dBoxProc,
- visible,
- goAway,
- 0x0,
- 300,
- ""
- };
-
- resource 'DLOG' (201) {
- {38, 16, 139, 256},
- dBoxProc,
- visible,
- goAway,
- 0x0,
- 201,
- ""
- };
-
- resource 'DLOG' (202) {
- {38, 17, 136, 256},
- dBoxProc,
- visible,
- goAway,
- 0x0,
- 202,
- ""
- };
-
- resource 'DITL' (200) {
- { /* array DITLarray: 6 elements */
- /* [1] */
- {74, 175, 94, 233},
- Button {
- enabled,
- "OK"
- },
- /* [2] */
- {48, 33, 64, 216},
- EditText {
- enabled,
- ""
- },
- /* [3] */
- {103, 6, 119, 230},
- EditText {
- enabled,
- ""
- },
- /* [4] */
- {74, 5, 93, 171},
- CheckBox {
- enabled,
- "Show Second TE Field"
- },
- /* [5] */
- {25, 3, 41, 196},
- StaticText {
- disabled,
- "Please enter your password:"
- },
- /* [6] */
- {2, 32, 18, 208},
- StaticText {
- disabled,
- "Two Item Password Dialog"
- }
- }
- };
-
- resource 'DITL' (300) {
- { /* array DITLarray: 2 elements */
- /* [1] */
- {41, 127, 61, 185},
- Button {
- enabled,
- "OK"
- },
- /* [2] */
- {2, 4, 35, 191},
- StaticText {
- disabled,
- "You entered the password: ^0"
- }
- }
- };
-
- resource 'DITL' (201) {
- { /* array DITLarray: 4 elements */
- /* [1] */
- {74, 175, 94, 233},
- Button {
- enabled,
- "OK"
- },
- /* [2] */
- {50, 22, 66, 213},
- EditText {
- enabled,
- ""
- },
- /* [3] */
- {25, 3, 41, 196},
- UserItem {
- disabled
- },
- /* [4] */
- {2, 13, 18, 228},
- UserItem {
- disabled
- }
- }
- };
-
- resource 'DITL' (202) {
- { /* array DITLarray: 4 elements */
- /* [1] */
- {74, 175, 94, 233},
- Button {
- enabled,
- "OK"
- },
- /* [2] */
- {48, 33, 64, 216},
- EditText {
- enabled,
- ""
- },
- /* [3] */
- {25, 3, 41, 196},
- StaticText {
- disabled,
- "Please enter your password:"
- },
- /* [4] */
- {3, 14, 20, 227},
- StaticText {
- disabled,
- "Internal Buffer Password Dialog"
- }
- }
- };
-
- data 'FONT' (3200, ".Pwd") {
- };
-
- resource 'FONT' (3212) {
- doExpandFont,
- proportionalFont,
- blackFont,
- notSynthetic,
- nofctbRsrc,
- oneBit,
- noCharWidthTable,
- noImageHeightTable,
- 32,
- 65,
- 9,
- 0,
- -3,
- 11,
- 15,
- 12,
- 3,
- 0,
- 1,
- $"0000 0000 0000 0000 1020 3870 7CFA FFFF"
- $"7CFA 3870 1020 0000 0000 0000 0000",
- { /* array: 36 elements */
- /* [1] */
- 0,
- /* [2] */
- 0,
- /* [3] */
- 0,
- /* [4] */
- 0,
- /* [5] */
- 0,
- /* [6] */
- 0,
- /* [7] */
- 0,
- /* [8] */
- 0,
- /* [9] */
- 0,
- /* [10] */
- 0,
- /* [11] */
- 0,
- /* [12] */
- 0,
- /* [13] */
- 0,
- /* [14] */
- 0,
- /* [15] */
- 0,
- /* [16] */
- 0,
- /* [17] */
- 0,
- /* [18] */
- 0,
- /* [19] */
- 0,
- /* [20] */
- 0,
- /* [21] */
- 0,
- /* [22] */
- 0,
- /* [23] */
- 0,
- /* [24] */
- 0,
- /* [25] */
- 0,
- /* [26] */
- 0,
- /* [27] */
- 0,
- /* [28] */
- 0,
- /* [29] */
- 0,
- /* [30] */
- 0,
- /* [31] */
- 0,
- /* [32] */
- 0,
- /* [33] */
- 0,
- /* [34] */
- 0,
- /* [35] */
- 7,
- /* [36] */
- 14
- },
- { /* array: 36 elements */
- /* [1] */
- 1,
- /* [2] */
- -1,
- /* [3] */
- -1,
- /* [4] */
- -1,
- /* [5] */
- -1,
- /* [6] */
- -1,
- /* [7] */
- -1,
- /* [8] */
- -1,
- /* [9] */
- -1,
- /* [10] */
- -1,
- /* [11] */
- -1,
- /* [12] */
- -1,
- /* [13] */
- -1,
- /* [14] */
- -1,
- /* [15] */
- -1,
- /* [16] */
- -1,
- /* [17] */
- -1,
- /* [18] */
- -1,
- /* [19] */
- -1,
- /* [20] */
- -1,
- /* [21] */
- -1,
- /* [22] */
- -1,
- /* [23] */
- -1,
- /* [24] */
- -1,
- /* [25] */
- -1,
- /* [26] */
- -1,
- /* [27] */
- -1,
- /* [28] */
- -1,
- /* [29] */
- -1,
- /* [30] */
- -1,
- /* [31] */
- -1,
- /* [32] */
- -1,
- /* [33] */
- -1,
- /* [34] */
- 9,
- /* [35] */
- 9,
- /* [36] */
- 0
- },
- { /* array: 0 elements */
- },
- { /* array: 0 elements */
- }
- };
-